package com.emotionalEnvelope.edu.constant;

/**
 * @Description
 * @Author lqq
 * @Date 2023/02/28 20:47
 */
public enum EmailTag {
    friend("friend", "交友"),
    happy("happy", "快乐"),
    angry("angry", "生气"),
    worry("worry", "担心"),
    miss("miss", "思念"),
    sad("sad", "失落"),
    secret("secret", "秘密"),
    love("love", "告白"),
    ;

    final String code;
    final String name;

    private EmailTag(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return this.code;
    }

    public String getName() {
        return name;
    }

    public EmailTag find(String code) {
        for (EmailTag each : EmailTag.values()) {
            //利用code进行循环比较，获取对应的枚举
            if (code.equals(each.getCode())) {
                return each;
            }
        }
        return null;
    }
}
